Class DirectoryImpl

All Implemented Interfaces:
IPCObject, Directory, SimFile
Direct Known Subclasses:
FileSystemImpl

public class DirectoryImpl extends SimFileImpl implements Directory
Information provided by the PKI file:

    \class Directory
    
    \brief Directory is the directory of the file systems for routers and switches.
    
    \example network().getDevice("Router0").getProcess("FileManager").getFileSystem("flash:")
    
Author:
Auto-generated
  • Constructor Details

  • Method Details

    • getFileCount

      public int getFileCount()
      Information provided by the PKI file:
      
          \brief Returns the number of files in the file system.
          
          \return int, the number of files in the file system.
          
              
      Specified by:
      getFileCount in interface Directory
      Returns:
      int Returns a int
    • getFileAt

      public SimFile getFileAt(int index)
      Information provided by the PKI file:
      
          \brief Returns the file at the specified index.
          
          \param index, the index of the file of interest.
          
          \return SimFile, the SimFile object at the specified index.
          
              
      Specified by:
      getFileAt in interface Directory
      Parameters:
      index - Takes in a parameter of index
      Returns:
      SimFile Returns a SimFile
    • getFile

      public SimFile getFile(String filename)
      Information provided by the PKI file:
      
          \brief Returns the file with the specified filename.
          
          \param filename, the filename of the file.
          
          \return SimFile, the SimFile object with the associated filename.
          
              
      Specified by:
      getFile in interface Directory
      Parameters:
      filename - Takes in a parameter of filename
      Returns:
      SimFile Returns a SimFile
    • fileExist

      public boolean fileExist(String name)
      Information provided by the PKI file:
      
          \brief Returns if a file exist in the file system
          
          \param name, file name
          
          \return bool, true if exists and false if not
          
              
      Specified by:
      fileExist in interface Directory
      Parameters:
      name - Takes in a parameter of name
      Returns:
      boolean Returns a boolean
    • getSpaceUsed

      public int getSpaceUsed()
      Information provided by the PKI file:
      
          \brief Returns the amount of space used on this file system.
          
          \return int, the amount of space used on this file system.
          
              
      Specified by:
      getSpaceUsed in interface Directory
      Returns:
      int Returns a int
    • addTextFile

      public boolean addTextFile(String name, String content, boolean bCheckPermission)
      Information provided by the PKI file:
      
          \brief Add text file into filesystem
          
          \param name, SimFile name
          
          \param content, file content
          
          \param bCheckPermission, true if write permission needs to be checked and false if otherwise
          
          \return bool, true if the file was added successfully and false if not
          
              
      Specified by:
      addTextFile in interface Directory
      Parameters:
      name - Takes in a parameter of name
      content - Takes in a parameter of content
      bCheckPermission - Takes in a parameter of bCheckPermission
      Returns:
      boolean Returns a boolean
    • addDirectory

      public boolean addDirectory(String name, boolean bCheckPermission)
      Information provided by the PKI file:
      
          \brief Add directory into filesystem
          
          \param name, Directory name
          
          \param bCheckPermission, true if write permission needs to be checked and false if otherwise
          
          \return bool, true if the file was added successfully and false if not
          
              
      Specified by:
      addDirectory in interface Directory
      Parameters:
      name - Takes in a parameter of name
      bCheckPermission - Takes in a parameter of bCheckPermission
      Returns:
      boolean Returns a boolean
    • addHttpPage

      public boolean addHttpPage(String name, String content, boolean bCheckPermission)
      Information provided by the PKI file:
      
          \brief Returns true if the HTTP page was added successfully, false otherwise.
          
          \param name, the name of the HTTP page.
          \param content, the content of the HTTP page.
          \param bCheckPermission, true to check permissions, false to skip.
          
          \return bool, true if the HTTP page was added successfully, false otherwise.
          
              
      Specified by:
      addHttpPage in interface Directory
      Parameters:
      name - Takes in a parameter of name
      content - Takes in a parameter of content
      bCheckPermission - Takes in a parameter of bCheckPermission
      Returns:
      boolean Returns a boolean
    • removeFile

      public boolean removeFile(String name, boolean bCheckPermission)
      Information provided by the PKI file:
      
          \brief Returns true if the file was removed successfully, false otherwise.
          
          \param name, the name of the file of interest.
          \param bCheckPermission, true to check permissions, false to skip.
          
          \return bool, true if the file was removed successfully, false otherwise.
          
              
      Specified by:
      removeFile in interface Directory
      Parameters:
      name - Takes in a parameter of name
      bCheckPermission - Takes in a parameter of bCheckPermission
      Returns:
      boolean Returns a boolean
    • removeAllFiles

      public boolean removeAllFiles(boolean bCheckPermission)
      Information provided by the PKI file:
      
          \brief Returns true if all files were removed successfully, false otherwise.
          
          \param bCheckPermission, true to check permissions, false to skip.
          
          \return bool, true if all files were removed successfully, false otherwise.
          
              
      Specified by:
      removeAllFiles in interface Directory
      Parameters:
      bCheckPermission - Takes in a parameter of bCheckPermission
      Returns:
      boolean Returns a boolean
    • renameFile

      public boolean renameFile(String oldName, String newName, boolean bCheckPermission)
      Information provided by the PKI file:
      
          \brief Returns true if the file was renamed successfully, false otherwise.
          
          \param oldName, the old file name
          
          \param newName, the new file name.
          
          \param bCheckPermission, true to check permissions, false to skip.
          
          \return bool, true if the file was renamed successfully, false otherwise.
          
              
      Specified by:
      renameFile in interface Directory
      Parameters:
      oldName - Takes in a parameter of oldName
      newName - Takes in a parameter of newName
      bCheckPermission - Takes in a parameter of bCheckPermission
      Returns:
      boolean Returns a boolean